package cn.szsys.integration.controller;

import cn.szsys.integration.constants.Validation;
import cn.szsys.integration.dto.InvestmentDTO;
import cn.szsys.integration.helper.BusinessBeanNameConstant;
import cn.szsys.integration.helper.manager.InvestmentForwardHandlerChainManager;
import cn.szsys.integration.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 人企投资
 *
 * @author Ryan
 * @since 2025-05-17
 **/
@RestController
@RequestMapping("investment")
@RequiredArgsConstructor
public class InvestmentController {
    private final InvestmentForwardHandlerChainManager investmentForwardHandlerChainManager;

    /**
     * 查询企业关联信息
     *
     * @param dto dto
     * @return {@link R}
     * @author Ryan
     */
    @PostMapping("/related")
    public R<?> related(@Validated({Validation.ConditionOne.class}) @RequestBody InvestmentDTO dto) {
        //中胜信用
        dto.setRouter(InvestmentDTO.RouterEnum.RELATED);
        return investmentForwardHandlerChainManager.handler(dto, BusinessBeanNameConstant.Investment.ZSXY_INVESTMENT_HANDLER_CHAIN);
    }

    /**
     * 基础信息
     *
     * @param dto dto
     * @return {@link R}
     * @author Ryan
     */
    @PostMapping("/baseInfo")
    public R baseInfo(@Validated({Validation.ConditionTwo.class}) @RequestBody InvestmentDTO dto) {
        //中胜信用
        dto.setRouter(InvestmentDTO.RouterEnum.BASE_INFO);
        return investmentForwardHandlerChainManager.handler(dto, BusinessBeanNameConstant.Investment.ZSXY_INVESTMENT_HANDLER_CHAIN);
    }
}
